package com.zzyd.common.mvp.presenter;

/**
 * @author wjunjie
 * @version 1.0
 * @E-mail wang_junjie007@163.com
 * @company ZZYD
 * @createTime 2018/7/20 16:34
 * @类注释:
 */
public abstract class BasePresenter<T extends BaseContract.View>
        implements BaseContract.Persenter {
    private T mView;

    public BasePresenter(T view) {
        setView(view);
    }

    protected void setView(T view){
        this.mView=view;
        this.mView.setPersenter(this);
    }

    protected T getView(){
        return mView;
    }

    @Override
    public void start() {
        T view=mView;
        if (view!=null){
            view.showLoading();
        }

    }

    @Override
    public void destory() {
        T view=mView;
        mView=null;
        if (view!=null){
            view.setPersenter(null);
        }
    }
}
